
function check_form(form, opts){
	if($(form).find('.error,.ext_error').length){
		$(opts.submit_btn).attr('disabled', 'disabled');
	}else{
		$('#mutil_error').html('');
		$(opts.submit_btn).removeAttr('disabled');
	}
}

var auto_check_opts = {
	'submit_btn' 	: '.save_btn',
	'next_focus'	: true,
	'onSuccess' 	: check_form
};

$(function(){
	$(".setting_form")
		.y_setting()
		.auto_check(auto_check_opts)
		.ajax_form({
			'submit_btn' 	: '.save_btn',
			'form_position'	: null,
			'success' 		: function(form, data){
				window.location.href = '/manage/article/edit/' + data;
			}
		});

	//注册编辑器窗口自动适应窗口大小
	addWinResize(function(){
		$('.editor .edui-editor').width($('.setting_content').width() - 20);
	});

	$('.auto_img').auto_img();
	$('.y_image_ul .img_li').each(function(){
		init_img_li(this);
	});
});
